﻿using System.Buffers;
//using ePipe;
using System.Text;

unsafe class Program
{
    class C1
    {
        public int num;
    }

    class MyClass
    {
        public C1 item1 = new C1() { num = 100 };
        public C1 item2 = new C1() { num = 200 };

        public (C1 item1, C1 item2) Get()
        {
            try
            {
                var item = (item1, item2);

                item1 = null;
                item2 = null;

                return item;
            }
            finally
            {
                Console.WriteLine("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE");
            }
        }
    }

    struct MyStruct
    {
        
    }


    static MyStruct* stru0;
    static MyStruct stru = new MyStruct();
    static unsafe void Main(string[] args)
    {
        fixed (MyStruct* m = &stru)
        {
            stru0 = m;
        }



        MyClass instace = new MyClass();
        var item = instace.Get();

        Console.WriteLine("111111>>>>" + (instace.item1 == null) + ">>>>>>>" + (instace.item2 == null));
        Console.WriteLine("111111>>>>" + (item.item1 == null) + ">>>>>>>" + (item.item2 == null));


        return;
        //string str = string.Empty;
        //for (int i = 0; i < 10; i++)
        //{
        //    str += $"<健捷狗东西-{i}>";
        //}

        //var buffer = Encoding.UTF8.GetBytes(str);
        //Console.WriteLine("------------------------------------" + buffer.Length);

        //var options = new PipeOptions();

        //Pipe pipe = new Pipe(options);


        //while (true)
        //{
        //    Console.ReadLine();

        //    pipe.Write(new ReadOnlyMemory<byte>(buffer));

        //    var buf = pipe.Read();
        //    var text = Encoding.UTF8.GetString(buf);
        //    pipe.AdvanceReader(buf.End);




        //    Console.WriteLine(text);
        //}
    }
}